package kr.hkit.androidcomplete01.chaptert09;

import kr.hkit.androidcomplete01.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;

public class ChangeMenuEx extends Activity {
	String TAG = "MenuChage";
	boolean mBeginner = true;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.d(TAG, "onCreate()");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.changemenuex);
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		Log.d(TAG, "onCreateOptionsMenu()");
		super.onCreateOptionsMenu(menu);
		MenuInflater inflater = getMenuInflater();
		if(mBeginner){
			inflater.inflate(R.menu.beginner, menu);
		} else {
			inflater.inflate(R.menu.professional, menu);
		}
		return true;
	}
	
	public void mOnClick(View v){
		Log.d(TAG, "mOnClick()");
		switch(v.getId()){
		case R.id.btnbeginner:
			mBeginner = true;
			invalidateOptionsMenu();
			break;
		case R.id.btnexpert:
			mBeginner = false;
			invalidateOptionsMenu();
			break;
		}
	}
}
